package com.ny.service.impl;
import com.ny.dao.StudentDao;
import com.ny.dao.impl.StudentDaoImpl;
import com.ny.entity.Student;
import com.ny.service.StudentService;

import java.sql.SQLException;
import java.util.List;

//调用数据访问层的方法
public class StudentServiceImpl implements StudentService {
    //        创建数据访问层的对象
    private StudentDao studentDao = new  StudentDaoImpl();
    public StudentServiceImpl() throws SQLException, ClassNotFoundException {
    }
    @Override
    public int add(Student student) throws SQLException, ClassNotFoundException {
//        调用数据访问层的添加方法
        return studentDao.add(student);

    }

    @Override
    public Student login(String studentName, String studentPassword) throws SQLException {

        return studentDao.login(studentName,studentPassword);
    }

    @Override
    public List<Student> findAllStudents() {
        return null;
    }

    @Override
    public Student getStudentById(int id) {
        return null;
    }

    @Override
    public int insertStudent(Student student) {
        return 0;
    }

    @Override
    public int updateStudent(Student student) {
        return 0;
    }

    @Override
    public int deleteStudent(int id) {
        return 0;
    }

    @Override
    public int updatePassword(String studentName, String oldPassword, String newPassword) throws SQLException {
        return studentDao.updatePassword(studentName, oldPassword, newPassword);
    }

}
